<?php /* @var $object LinkEmployeeLeave*/?>
<?php /* @var $criteria Criteria*/?>
<?php foreach ($objects as $object):?>
<?php if(sfConfig::get('group_by')){
    $method_g = 'get'.ucfirst(sfConfig::get('group_by'));
    if ( empty($last_group) || $last_group != $object->$method_g() ) {
        $last_group = $object->$method_g();
        echo "<tr><td colspan='15' class='group_by'>".$last_group."</td></tr>";
    }
}
?>

    <?php include_partial('Reports/row',array('object'=>$object,'fields'=>$fields)); ?>

            <?php if($compared_monthes = sfConfig::get('compared_months',null)){?>
            <?php 
            unset($compared_monthes[$object->getMonth()]);
            $criteria2 = new Criteria();
            $criteria2->add(LinkEmployeeLeavePeer::MONTH , $compared_monthes , Criteria::IN );
            $criteria2->add(LinkEmployeeLeavePeer::YEAR  , sfConfig::get('compared_year',$object->getYear()) );
            $criteria2->add(LinkEmployeeLeavePeer::EMPLOYEE_ID   , $object->getEmployeeId() );
            $criteria2->add(LinkEmployeeLeavePeer::LEAVE_TYPE_ID  , $object->getLeaveTypeId() );
            $criteria2->addDescendingOrderByColumn(LinkEmployeeLeavePeer::MONTH );
	            foreach (LinkEmployeeLeavePeer::doSelect($criteria2) as $object):?>
 				
    	        <?php include_partial('Reports/row',array('object'=>$object,'fields'=>$fields,'class'=>'heighlighted')); ?>
            
	            <?php endforeach;?>
            
            <?php }?>
<?php endforeach;?>



